package PowerWord.Core.Plan;

import java.util.Random;

import PowerWord.Core.Data.WordList;

public abstract class Duty {

	protected WordList list = null;
	protected Integer[] subList = null;
	protected Integer[] bacList = null;
	
	public Duty(WordList l){
		list = l;
	}
	
	protected abstract void CreateWork(String arg0, String arg1, int flag);
	
	protected void GotoNext(){}
	protected void GotoPrev(){}
	
	protected void Random(){
		bacList = subList.clone();
		Random seed = new Random();
		int pos, val;
		for(int i=subList.length; i>0; --i){
			pos = seed.nextInt(i);
			val = subList[pos];
			subList[pos] = subList[i-1];
			subList[i-1] = val;
		}
	}
	
	protected void Order(){
		subList = bacList.clone();
		bacList = null;
	}
	
	protected int GetCount(){
		return subList.length;
	}
}
